<?php
// | 初始化
// +----------------------------------------------------------------------
// | Author: carl <469714167@qq.com>
// +----------------------------------------------------------------------
// | Datetime: 2017-8-28 9:40:12
// +----------------------------------------------------------------------

namespace app\wx\controller;

use org\MonModel;
use think\Controller;
use think\Db;
use think\Cache;
use org\Wechat;
class Init extends Controller
{
    protected $userId;
    // protected $type;
    // protected $info;

    protected function _initialize()
    {
        // parent::_initialize();
        // if (request()->isOptions()){
        //     echo ''; exit();
        // }
        // header('Access-Control-Allow-Origin: *');
        // header('Access-Control-Allow-Credentials: true');
        // header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
        // $param = input('post.');
        // if(isset($param['userId'])){
        //   $this->userId = $param['userId']; 
        // }
        // $this->wechat = new Wechat( config('wechat_conf') );
    }

    /**
     * 获取缓存，按需重载
     * @param string $cachename
     * @return mixed
     */
    protected function getCache($cachename){
        //TODO: get cache implementation
        return Cache::get($cachename);
    }

    protected function setCache($cachename,$value,$expired){
        //TODO: set cache implementation
        return Cache::set($cachename,$value,$expired);
    }

    protected function removeCache($cachename){
        //TODO: remove cache implementation
        return Cache::rm($cachename);
    }

}